package com.capgemini.scaffold.utils;


import com.capgemini.scaffold.dto.LoginFromDTO;

/**
 * @author ShuHao.Wen
 * @since 2022/10/18
 * ThreadLocal类
 */
public class UserHolder {
    private static final ThreadLocal<LoginFromDTO> tl = new ThreadLocal<>();

    public static void saveUser(LoginFromDTO loginFromDTO){
        tl.set(loginFromDTO);
    }

    public static LoginFromDTO getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }
}
